package net.message;

import net.message.processor.IMessageProcessor;
import net.Client;

import util.Config;

public class HelloRequestMessage implements Message{

    public final String clientName;
    
    public HelloRequestMessage(String clientName) {
        this.clientName = clientName;
    }

    public HelloRequestMessage(byte[] source) {
        this(new String(source, Config.getInstance().getEncoding()));
    }

    @Override
    public void accept(IMessageProcessor processor, Client client) {
        processor.process(this, client);
    }

    public byte[] toByteArray() {
        return clientName.getBytes(Config.getInstance().getEncoding());
    }

    @Override
    public MessageType getType(){
        return MessageType.HELLO_REQUEST;
    }



}
